package com.woniu.adapter;

import com.woniu.outlet.mysql.EarningsDao;
import com.woniu.outlet.mysql.po.EarningsMySQL;
import com.woniu.service.bean.AddEarnings;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class EarningsAdapter {

    @Autowired
    private EarningsDao earningsDao;

    /**
     * 向平台收益表添加数据的方法
     */
    public void addEarnings(AddEarnings earnings){
        EarningsMySQL earningsMySQL = EarningsMySQL.builder()
                .dealTime(earnings.getDealTime())
                .dealType(earnings.getDealType())
                .userId(earnings.getUserId())
                .dealPrice(earnings.getDealPrice())
                .dealCharge(earnings.getDealCharge())
                .productType(earnings.getProductType())
                .build();
        earningsDao.insert(earningsMySQL);
    }
}
